package com.g1.screens.enumerations;

import org.newdawn.slick.Image;

public enum BlockType {
	
	WHITE(0,"white",10,5),
	RED(1,"red",10,70),
	YELLOW(2,"yellow",10,135),
	BLUE(3,"blue",10,200),
	SILVER(4,"silver",10,265),
	GRAY(5,"gray",10,330)
	;
	
	private int id;
	private String name;
	private Image image;
	
	public final static int width = 65;//size in pxl
	public final static int height = 65;//size in pxl
	
 	private int x;
 	private int y;
	
	 BlockType(final int id, final String name,final int x, final int y){
		 this.id = id;
		 this.name = name;
		 this.x = x;
		 this.y = y;
	 }

	public int getId() {
		return id;
	}

	public String getName() {
		return name;
	}
	
	public Image getImage(Image res){
		return res.getSubImage(x, y, width, height);
	}
	public static BlockType getId(final int id){
		switch(id){
			case 0 : return WHITE;
			case 1 : return RED;
			case 2 : return YELLOW;
			case 3 : return BLUE;
			case 4 : return SILVER;
			case 5 : return GRAY;
			default : throw new IllegalArgumentException("id "+id+" is not a valid BlockType");
		}
	}

}
